package com.fortune.service.impl;

import com.fortune.dao.DCRelationDao;
import com.fortune.dto.in.dCRelation.DCRelationListDto;
import com.fortune.service.DCRelationService;
import com.fortune.vo.dCRelation.DCRelationInfo;
import com.fortune.vo.dCRelation.DCRelationList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DCRelationServiceImpl implements DCRelationService {
    @Autowired
    private DCRelationDao dcRelationDao;

    /**
     * 查询经销商与客户列表
     * @param dealerId
     * @param dcRelationListDto
     * @return
     */
    @Override
    public List<DCRelationList> queryDelareClientList(String dealerId, DCRelationListDto dcRelationListDto) {
        return dcRelationDao.queryDelareClientList(dealerId,dcRelationListDto);
    }

    /**
     * 查询经销商与客户列表个数
     * @param dealerId
     * @param dcRelationListDto
     * @return
     */
    @Override
    public int queryDelareClientListCount(String dealerId, DCRelationListDto dcRelationListDto) {
        return dcRelationDao.queryDelareClientListCount(dealerId,dcRelationListDto);
    }

    /**
     * 查询客户详情
     * @param phone
     * @return
     */
    @Override
    public DCRelationInfo queryClientInfo(String phone) {
        return dcRelationDao.queryClientInfo(phone);
    }

    /**
     * 查询经销商与客户关系是否存在
     * @param dealerId
     * @param id
     * @return
     */
    @Override
    public int queryRelationIsExist(String dealerId, String id) {
        return dcRelationDao.queryRelationIsExist(dealerId,id);
    }

    /**
     * 添加经销商与客户关系
     * @param dealerId
     * @param id
     * @return
     */
    @Override
    public int addRelationIs(String dealerId, String id) {
        return dcRelationDao.addRelationIs(dealerId,id);
    }

    /**
     * 删除客户
     * @param dealerId
     * @param id
     * @return
     */
    @Override
    public int delete(String dealerId, String id) {
        return dcRelationDao.delete(dealerId,id);
    }
}
